Skip to content

Support Map<String, String> in FormHttpMessageWriter and FormHttpMessageReader#36676

Open
tianhaocui wants to merge 1 commit intospring-projects:mainfrom
tianhaocui:support-map-in-form-message-codecs
Open

Support Map<String, String> in FormHttpMessageWriter and FormHttpMessageReader#36676
tianhaocui wants to merge 1 commit intospring-projects:mainfrom
tianhaocui:support-map-in-form-message-codecs

Conversation

@tianhaocui
Copy link
Copy Markdown
Contributor

Closes #36536

Widens FormHttpMessageWriter and FormHttpMessageReader to support Map<String, String> in addition to MultiValueMap<String, String>, aligning the reactive codecs with the imperative FormHttpMessageConverter updated in #36408.

FormHttpMessageWriter:

  • Widens generic type from MultiValueMap to Map
  • canWrite() accepts both Map and MultiValueMap with String values
  • write() dispatches between MultiValueMap and plain Map serialization
  • Adds serializeForm(Map) overload for plain Map entries

FormHttpMessageReader:

  • Widens generic type from MultiValueMap to Map
  • canRead() accepts both Map and MultiValueMap with String values
  • readMono() returns asSingleValueMap() for plain Map target type

MultipartHttpMessageWriter:

  • Widens formWriter field type to HttpMessageWriter<? super MultiValueMap<String, String>>

…ageReader

Widen FormHttpMessageWriter and FormHttpMessageReader to support
Map<String, String> in addition to MultiValueMap<String, String>,
aligning the reactive codecs with the imperative FormHttpMessageConverter
which was updated in spring-projects#36408.

FormHttpMessageWriter:
- Widen generic type from MultiValueMap to Map
- canWrite() accepts both Map and MultiValueMap with String values
- write() dispatches between MultiValueMap and plain Map serialization
- Add serializeForm(Map) overload for plain Map entries

FormHttpMessageReader:
- Widen generic type from MultiValueMap to Map
- canRead() accepts both Map and MultiValueMap with String values
- readMono() returns asSingleValueMap() for plain Map target type

MultipartHttpMessageWriter:
- Widen formWriter field type to HttpMessageWriter<? super MultiValueMap>

Closes spring-projects#36536

Signed-off-by: cuitianhao <54015884+tianhaocui@users.noreply.github.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 20, 2026
@sbrannen sbrannen added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels May 3, 2026
@sbrannen sbrannen requested review from bclozel and sdeleuze and removed request for sdeleuze May 3, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: web Issues in web modules (web, webmvc, webflux, websocket) status: waiting-for-triage An issue we've not yet triaged or decided on type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Map body types in Http form codecs

3 participants